package com.macro.mall.portal.service.impl;

import cn.hutool.core.date.DateTime;
import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.BmsFunMapper;
import com.macro.mall.model.BmsFun;
import com.macro.mall.model.BmsFunExample;
import com.macro.mall.portal.dto.BmsFunParam;
import com.macro.mall.portal.service.BmsFunService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class BmsFunServiceImpl implements BmsFunService {
    @Autowired
    private BmsFunMapper bmsFunMapper;


    /**
     * 分页查询
     */
    @Override
    public List<BmsFun> getList(BmsFunParam bmsFunParam) {
        PageHelper.startPage(bmsFunParam.getPageNum(), bmsFunParam.getPageSize());
         BmsFun bmsFun = new BmsFun();
         BeanUtils.copyProperties(bmsFunParam, bmsFun);
        List<BmsFun> list = bmsFunMapper.selectAll(bmsFun);
        return list;
    }

    /**
     * 根据id查询
     */
    @Override
    public BmsFun getItem(Long id) {
        return bmsFunMapper.selectByPrimaryKey(id);
    }


}
